<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="lushu">
		<title>备用金充值撤销</title>
		<script language="javascript" type="text/javascript" src="../script/print.js"></script>
		<script language="javascript" src="../script/common.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript">
			var Page;
			
			//初始化页面信息
			function load(){
				Page = {};
				Page.form = $("operationForm");
				Page.bill = 'trade_out_bill';
				Page.preResult = function(result){
					showInformation("备用金充值撤销成功");
				}
				Eui.showNavigation();	
				Common.initDict(Page.form.accCode,TX.AccountType.deposit());
				Common.initDict(Page.form.payType,Common.getSubsetItems("pay_type",TX.PAYMENT_TYPE));
				changeAccCode();
				setPages(["formDiv","printSheetDiv","billDiv"]);
			}
			//更改帐户类型
			function changeAccCode(){
				var unit = (Common.getItem('account_type',Page.form.accCode.value))["unit"];
				Page.form.unit.value = Common.getText("account_unit",unit);
				Page.amountValidator = Account.getValidatorByUnit(unit);
			}
			//取消操作,返回起始页面
			function cancel(){
				Page.form.reset();
				changeAccCode();
				switchPage("formDiv");
			}
			//充值撤销方法
			function spareDepositCancel(){
				if(!checkForm(Page.form.id))
					return;
				var data = Common.getValues(Page.form);
				var confirmString =   "撤销备用金充值:" + TX.SHOW_INFO_LINEBREAK
									+ "原帐户编号:" + data.cardUserUnique + TX.SHOW_INFO_LINEBREAK
									+ "原交易流水号:" + data.tradeId + TX.SHOW_INFO_LINEBREAK
									+ "帐户类型:" + Common.getText('account_type',data.accCode) + TX.SHOW_INFO_LINEBREAK
									+ "帐户单位:" + data.unit + TX.SHOW_INFO_LINEBREAK
									+ "原充值额:" + data.amount + TX.SHOW_INFO_LINEBREAK;
				if(showQuestion(confirmString)){
					DWR.call("tradeService.cancelTrade",
							data.cardUserUnique,
							data.tradeId,
							data.accCode,
							data.payType,
							Account.valueInByAccCode(data.accCode,data.amount),
							TX.Trade.showResult,
							{blockScreen:true}
						);
				}else{
					Page.form.amount.focus();
				}
			}
		</script>
	</head> 
	<body onload="load()">
		<div class="nav">
			<div id="nav"></div>
		</div>
		<!--备用金充值撤销页面部分-->
		<div id="formDiv">
			<form id="operationForm" name="operationForm">
				<div class="form">
					<div class="formTitle">备用金充值撤销</div>
					<table cellSpacing="0" cellPadding="4" width="100%" border="0" class="col2 label6">
						<tr>
							<td><label>客户编号</label> <input type="text" maxlength="18" name="cardUserUnique" onblur="checkV(this,'UniqueId',true)"><span class="des">*</span></td>
							<td><label>原交易流水号</label> <input type="text" name="tradeId" onblur="checkV(this,'long',true)"><span class="des">*</span></td>
						</tr>
						<tr>
							<td><label>帐户类型</label> <select name="accCode" onchange="changeAccCode()"><option></option></select></td>
							<td><label>帐户单位</label> <input type="text" name="unit" readonly class="readonly"></td>
						</tr>	
						<tr>
							<td><label>原充值额</label> <input type="text" name="amount" onblur="Page.amountValidator(this)"><span id="unit"></span><span class="des">*</span></td>
							<td><label>原支付类型</label> <select name="payType" ><option></option></select></td>
						</tr>	
					</table>
				</div>
				<p>
					<button name="spareBack" onclick="spareDepositCancel()">撤 销</button> 
					<button onclick="cancel()">取 消</button>
				</p>  
			</form>
		</div>
		
		<!--备用金撤销明细静态显示部分-->
		<div id="printSheetDiv" style="display:none;">
			<div class="form">
				<div class="formTitle">充值撤销明细</div>
				<div id="mainTrade"></div>
			</div>
			<p>
				<!--
			<button onclick="WebPrint.preview('printArea')">打印预览</button>
			<button onclick="WebPrint.print('printArea')">打印</button>
				-->
				<button onclick="cancel()">返 回</button>
			</p>
		</div>
		
		<div id="billDiv" class="form" width="100% " style="display:none;">
			<div class="formTitle">
				<div class="l">交易凭证</div>
				<div class="r">
					<button onclick="WebPrint.preview('content')">打印预览</button>
			 		<button onclick="WebPrint.print('content')">打印</button>
			 		<button onclick="cancel()">返 回</button>
				</div>
			</div>
			<div  id="content"  align='center'></div>
		</div>
	</body>
</html>